<HTML>
<HEAD>
  <!-- Created with AOLpress/2.0 -->
  <!-- AP: Created on: 29-Nov-2001 -->
  <!-- AP: Last modified: 26-May-2004 -->
  <LINK REL="icon" href="fftype16.png">
  <TITLE>Macintosh font formats</TITLE>
  <LINK REL="stylesheet" TYPE="text/css" HREF="FontForge.css">
</HEAD>
<BODY>
<DIV id="in">
<H1 ALIGN=Center>
  Macintosh font formats
</H1>
<P>
The mac stores fonts in resources. It use to store resources in resource
forks (which have no representation on unix) but now (Mac OS/X) it also stores
them in data forks.
<P>
Apple (and Adobe) provide some documentation on the mac's formats:
<UL>
  <LI>
    <A HREF="http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-9.html">Mac
    Resource Fork</A>
  <LI>
    Mac
    <A HREF="http://developer.apple.com/documentation/mac/Text/Text-250.html">NFNT/FONT</A>
    resource
  <LI>
    Mac
    <A HREF="http://developer.apple.com/documentation/mac/Text/Text-269.html">FOND</A>
    resource
  <LI>
    Mac
    <A HREF="http://developer.apple.com/documentation/mac/Text/Text-253.html">sfnt</A>
    resource
    <UL>
      <LI>
	This is basically a <A HREF="http://fonts.apple.com/TTRefMan/">truetype</A>
	font file stuffed into a resource
    </UL>
  <LI>
    The POST resource
    <UL>
      <LI>
	The connection between postscript file and FOND is described in the
	<A HREF="http://developer.apple.com/documentation/mac/Text/Text-275.html">Style
	Mapping Table</A> of the FOND
      <LI>
	<A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/T1_SPEC.PDF">Type1
	postscript fonts </A>are described by Adobe
      <LI>
	Adobe also describes how they are
	<A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/0091.Mac_Fond.pdf">wrapped
	up on the mac.</A>
    </UL>
  <LI>
    <A HREF="http://developer.apple.com/documentation/mac/Text/Text-354.html">Macintosh
    scripts</A>
    <UL>
      <LI>
	<A HREF="http://developer.apple.com/documentation/mac/Text/Text-367.html#HEADING367-0">Script
	codes</A>
    </UL>
  <LI>
    <A HREF="http://developer.apple.com/documentation/macosx/Carbon/carbon.html">Carbon
    (Mac OS/X) docs</A>
</UL>
<P>
<A NAME="dfont">I</A> have not yet found a description of a data fork resource
file. I have determined empirically that they look almost the same as
<A HREF="http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-9.html">resource
fork resource files</A> except that the map table begins with 16 bytes of
zeros rather than a copy of the first 16 bytes of the file. To date I have
only seen sfnt (and FOND) resources in a data fork resource file (often called
a .dfont file).
<P>
FontForge does not support the old 'fbit' font format for CJK encodings (but
then neither does the Mac any more so that's probably not an issue).
<P>
When an 'sfnt' resource contains a font with a multibyte encoding (CJK or
unicode) then the 'FOND' does not have entries for all the characters. The
'sfnt' will (always?) have a MacRoman encoding as well as the multibyte encoding
and the 'FOND' will contain information on just that subset of the font.
(I have determined this empirically, I have seen no documentation on the
subject)
<P>
Currently bitmap fonts for multibyte encodings are stored inside an sfnt
(truetype) resource in the 'bloc' and 'bdat' tables. When this happens there
are a series of dummy 'NFNT' resources in the resource file, one for each
strike. Each resource is 26 bytes long (which means they contain the FontRec
structure but no data tables) and are flagged by having rowWords set to 0.
(I have determined this empirically, I have seen no documentation on the
subject)
<P>
When a 'sfnt' resource contains only bitmaps (and no glyph outlines) it is
sometimes called an 'sbit'.
<H2>
  Resource forks on Mac OS/X
</H2>
<P>
The unix filename for the resource fork of the file "foo" is "foo/rsrc".
(I was told this and it appears to be correct, I have seen no documentation
on the subject)
</DIV>
</BODY></HTML>
